clear
use ReplicationData.dta

*Figure 1a*
preserve
label var treatment_abandon "Unconditional Abandonment"
label var treatment_reassurance "Unconditional Reassurance"
label var treatment_conditional "Conditional Pressure"
label var treatment_domestic "Domestic Pressure"
label var treatment_normative "Appeal to Obligations"
label var treatment_shaming "Shaming"
reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store base
reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming female age education polawareness country_id
estimates store controls
coefplot (base, label(Baseline)) (controls, label(With Controls) msymbol(triangle) ciopts(lpattern(dash_dot))) ///
|| , drop(_cons ) graphregion(fcolor(white)) xline(0) order(treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id female age education polawareness)  scheme(white_tableau)
*graph export "Figure1a.jpg", replace quality(100) width(600) height(800)
*graph export "Figure1a.eps", replace 
eststo clear
restore

*Figure 1b*
preserve
label var treatment_abandon "Unconditional Abandonment"
label var treatment_reassurance "Unconditional Reassurance"
label var treatment_conditional "Conditional Pressure"
label var treatment_domestic "Domestic Pressure"
label var treatment_normative "Appeal to Obligations"
label var treatment_shaming "Shaming"
reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store full
reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative if country=="Poland"
estimates store poland
reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming if country=="Germany"
estimates store germany
coefplot (full, label(Full Sample)) (poland, label(Poland) msymbol(diamond) ciopts(lpattern(dot))) (germany, label(Germany) msymbol(square) ciopts(lpattern(dash))) ///
|| , drop(_cons ) graphregion(fcolor(white)) xtick(-0.4(0.2)0.4) xlabel(-0.4(0.2)0.4) xline(0) order(treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id) scheme(white_tableau) 
*graph export "Figure1b.jpg", replace quality(100) width(600) height(800)
*graph export "Figure1b.eps", replace
eststo clear
restore

*Figure 2a*
preserve
eststo clear
reg defensespend i.treatment_reassurance##c.threatperception_pretreat i.treatment_abandon##c.threatperception_pretreat i.treatment_conditional##c.threatperception_pretreat i.treatment_domestic##c.threatperception_pretreat i.treatment_normative##c.threatperception_pretreat country_id
eststo M
listcoef, help //returns the coeficients; "help listcoef" to learn 
//now the margins
estimates restore M
margins, dydx(treatment_domestic) at(threatperception_pretreat=(1(1)5)) atmeans predict(xb) coeflegend post
est store domestic
estimates restore M
margins, dydx(treatment_abandon) at(threatperception_pretreat=(1(1)5)) atmeans predict(xb) coeflegend post
est store abandon
estimates restore M
margins, dydx(treatment_conditional) at(threatperception_pretreat=(1(1)5)) atmeans predict(xb) coeflegend post
est store conditional
est restore M
margins, dydx(treatment_reassurance) at(threatperception_pretreat=(1(1)5)) atmeans predict(xb) coeflegend post
est store reassurance

coefplot (reassurance, offset(-0.33)) (abandon, offset(-0.16)) (conditional, offset(0)) (domestic, offset(0.16)), ///
recast(bar) barw(0.15) vertical ylab(0(.1).7) ///
ciopts(recast(rcap) color(black%50)) citop ///
legend(order(1 "Reassurance" 3 "Abandonment" ///
5 "Conditional Pressure" 7 "Domestic Pressure")) ///
ytitle("Treatment Effects") ///
xtitle("Threat perception (pre-treatment)")  ///
xlabel(1(1)5) ytick(-1(0.2)1) ylabel(-1(0.2)1) graphregion(fcolor(white)) yline(0, lpattern(dash) lstyle(foreground) lcolor(black)) scheme(white_tableau)
*graph export "Figure2a.jpg", replace quality(100) width(600) height(800)
*graph export "Figure2a.eps", replace
eststo clear
restore



*Figure 2b*
preserve
eststo clear
reg defensespend i.treatment_reassurance##c.usconfidence i.treatment_abandon##c.usconfidence i.treatment_conditional##c.usconfidence i.treatment_domestic##c.usconfidence i.treatment_normative##c.usconfidence country_id
eststo M
listcoef, help //returns the coeficients; "help listcoef" to learn 
//now the margins
estimates restore M
margins, dydx(treatment_domestic) at(usconfidence=(1(1)5)) atmeans predict(xb) coeflegend post
est store domestic
estimates restore M
margins, dydx(treatment_abandon) at(usconfidence=(1(1)5)) atmeans predict(xb) coeflegend post
est store abandon
estimates restore M
margins, dydx(treatment_conditional) at(usconfidence=(1(1)5)) atmeans predict(xb) coeflegend post
est store conditional
est restore M
margins, dydx(treatment_reassurance) at(usconfidence=(1(1)5)) atmeans predict(xb) coeflegend post
est store reassurance

coefplot (reassurance, offset(-0.33)) (abandon, offset(-0.16)) (conditional, offset(0)) (domestic, offset(0.16)), ///
recast(bar) barw(0.15) vertical ylab(0(.1).7) ///
ciopts(recast(rcap) color(black%50)) citop ///
legend(order(1 "Reassurance" 3 "Abandonment" ///
5 "Conditional Pressure" 7 "Domestic Pressure")) ///
ytitle("Treatment Effects") ///
xtitle("Confidence in the US (pre-treatment)")  ///
xlabel(1(1)5) ytick(-1(0.2)1) ylabel(-1(0.2)1) graphregion(fcolor(white)) yline(0, lpattern(dash) lstyle(foreground) lcolor(black)) scheme(white_tableau)
*graph export "Figure2b.jpg", replace quality(100) width(600) height(800)
*graph export "Figure2b.eps", replace
eststo clear
restore


*Figure 3*
preserve
eststo clear
label var treatment_abandon "Unconditional Abandonment"
label var treatment_reassurance "Unconditional Reassurance"
label var treatment_conditional "Conditional Pressure"
label var treatment_domestic "Domestic Pressure"
label var treatment_normative "Appeal to Obligations"
label var treatment_shaming "Shaming"
eststo: reg moralobligation treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store moral
eststo: reg confidence_us treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store confidence
eststo: reg threatperception treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store threat
eststo: reg reactance treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
estimates store react
coefplot threat confidence moral react, keep(treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming) ///
recast(bar) barw(0.15) vertical ylab(0(.1).7) ///
ciopts(recast(rcap) color(black%50)) citop ///
legend(order(1 "Threat Perception" 3 "Distrust of US" ///
5 "Moral Obligation" 7 "Reactance")) ///
ytitle("Treatment Effects") ///
xtitle("Treatment Condition") xsc(titlegap(2) outergap(0))  ///
xlabel(1 "Reassure" 2 "Abandon" 3 "Conditional" 4 "Domestic" 5 "Obligations" 6 "Shaming") ytick(-1(0.2)1) ylabel(-1(0.2)1) graphregion(fcolor(white)) yline(0, lpattern(dash) lstyle(foreground) lcolor(black)) scheme(white_tableau)
*graph export "Figure3.jpg", replace quality(100) width(600) height(800)
*graph export "Figure3.eps", replace
eststo clear
restore





***APPENDIX***

*Table A1*
sutex2 defensespend control treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative age female education polawareness, varlabels minmax

sutex2 defensespend control treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative age female education polawareness if country=="Poland", varlabels minmax

sutex2 defensespend control treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming age female education polawareness if country=="Germany", varlabels minmax


*Table A2*
eststo clear
eststo: reg age treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg female treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg education treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg generaltrust treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg internationaltrust treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg usconfidence treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg defenseguess2 treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo: reg polawareness treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id 
eststo clear

*Table A3*
eststo clear
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative if country=="Poland"
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming if country=="Germany"
eststo clear

*Table A4*
eststo clear
eststo: reg defensespend i.treatment_reassurance##c.threatperception_pretreat i.treatment_abandon##c.threatperception_pretreat i.treatment_conditional##c.threatperception_pretreat i.treatment_domestic##c.threatperception_pretreat i.treatment_normative##c.threatperception_pretreat i.treatment_shaming##c.threatperception_pretreat country_id
eststo: reg defensespend i.treatment_reassurance##c.usconfidence i.treatment_abandon##c.usconfidence i.treatment_conditional##c.usconfidence i.treatment_domestic##c.usconfidence i.treatment_normative##c.usconfidence i.treatment_shaming##c.usconfidence country_id
eststo clear

*Table A5*
eststo clear
eststo: reg threatperception treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo: reg confidence_us treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo: reg moralobligation treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo: reg reactance treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo clear

*Table A6*
eststo clear
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming female age education polawareness country_id
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming defenseguess2 militarism female age education polawareness catholic protestant country_id
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative defenseguess2 militarism female age education polawareness catholic protestant i.party_poland if country=="Poland"
eststo: reg defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming defenseguess2 militarism female age education polawareness catholic protestant i.party_germany if country=="Germany"
eststo clear

*Table A7*
eststo clear
eststo: ologit defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming country_id
eststo: ologit defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative if country=="Poland"
eststo: ologit defensespend treatment_reassurance treatment_abandon treatment_conditional treatment_domestic treatment_normative treatment_shaming if country=="Germany"
eststo clear

*Figure A1a*
preserve
eststo clear
reg defensespend i.treatment_reassurance##i.prosocial i.treatment_abandon##i.prosocial i.treatment_conditional##i.prosocial i.treatment_domestic##i.prosocial i.treatment_normative##i.prosocial i.treatment_shaming##i.prosocial country_id
eststo M
listcoef, help //returns the coeficients; "help listcoef" to learn 
//now the margins
estimates restore M
margins, dydx(treatment_reassurance) at(prosocial=(0(1)1)) atmeans predict(xb) coeflegend post
est store reassurance
estimates restore M
margins, dydx(treatment_normative) at(prosocial=(0(1)1)) atmeans predict(xb) coeflegend post
est store normative
estimates restore M
margins, dydx(treatment_shaming) at(prosocial=(0(1)1)) atmeans predict(xb) coeflegend post
est store shaming

coefplot reassurance (normative, mcolor(purple) mfcolor(purple) bcolor(purple) blcolor(black)) (shaming, mcolor(brown) mfcolor(brown) bcolor(brown) blcolor(black)), ///
recast(bar) barw(0.15) vertical ylab(0(.1).7) ///
ciopts(recast(rcap) color(black%50)) citop ///
legend(order(1 "Reassurance" 3 "Appeal to Obligations" ///
5 "Shaming")) ///
ytitle("Treatment Effects") ///
xtitle("Prosocial")  ///
xlabel(1 "Not prosocial" 2 "Prosocial") ytick(-1(0.2)1) ylabel(-1(0.2)1) graphregion(fcolor(white)) yline(0, lpattern(dash) lstyle(foreground) lcolor(black)) scheme(white_tableau)
eststo clear
restore


*Figure A1b*
preserve
eststo clear
reg defensespend i.treatment_reassurance##c.nationalism i.treatment_abandon##c.nationalism i.treatment_conditional##c.nationalism i.treatment_domestic##c.nationalism i.treatment_normative##c.nationalism i.treatment_shaming##c.nationalism country_id
eststo M
reg defensespend i.treatment_reassurance##c.nationalism i.treatment_abandon##c.nationalism i.treatment_conditional##c.nationalism i.treatment_domestic##c.nationalism i.treatment_normative##c.nationalism i.treatment_shaming##c.nationalism if country=="Germany"
eststo K
listcoef, help //returns the coeficients; "help listcoef" to learn 
//now the margins
estimates restore M
margins, dydx(treatment_domestic) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store domestic
estimates restore M
margins, dydx(treatment_abandon) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store abandon
estimates restore M
margins, dydx(treatment_conditional) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store conditional
est restore M
margins, dydx(treatment_reassurance) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store reassurance
est restore M
margins, dydx(treatment_normative) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store normative
est restore M
margins, dydx(treatment_shaming) at(nationalism=(1(1)5)) atmeans predict(xb) coeflegend post
est store shaming

coefplot reassurance abandon conditional domestic (normative, bcolor(purple) mlcolor(black) blcolor(black)) (shaming, bcolor(brown) mlcolor(black) blcolor(black)), ///
recast(bar) barw(0.15) vertical ylab(0(.1).7) ///
ciopts(recast(rcap) color(black%50)) citop ///
legend(order(1 "Reassurance" 3 "Abandonment" ///
5 "Conditional Pressure" 7 "Domestic Pressure" 9 "Appeal to Obligations" 11 "Shaming")) ///
ytitle("Treatment Effects") ///
xtitle("Nationalism")  ///
xlabel(1(1)5) ytick(-1(0.2)1) ylabel(-1(0.2)1) graphregion(fcolor(white)) yline(0, lpattern(dash) lstyle(foreground) lcolor(black)) scheme(white_tableau)
eststo clear
restore
